package embedding

import "fmt"

type Animal interface {
	Speak() string
}

type Dog struct{}

func (d Dog) Speak() string { // 基础实现
	return "Woof!"
}

type LoudDog struct {
	Dog // 内嵌Dog
}

// 尝试重写Speak方法
// func (ld LoudDog) Speak() string {
// 	return ld.Dog.Speak() + "!!!" //Woof!!!!
// }

func runDogTest() {
	var a Animal = LoudDog{}
	fmt.Println(a.Speak())
}
